package com.takeshequ.main;

import org.apache.commons.lang3.StringUtils;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.takeshequ.R;

public class ContentItem implements ListItems {

	private Item mItem;
	private String tag;

	public ContentItem(Item item) {
		mItem = item;
	}

	public Item getmItem() {
		return mItem;
	}

	public void setmItem(Item mItem) {
		this.mItem = mItem;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	@Override
	public int getLayout() {
		return R.layout.main_left_content_layout;
	}

	@Override
	public boolean isClickable() {
		return true;
	}

	@Override
	public View getView(Context context, View convertView,
			LayoutInflater inflater) {
		convertView = inflater.inflate(getLayout(), null);
		ImageView iv = (ImageView) convertView.findViewById(R.id.content_image);
		iv.setImageResource(mItem.getResid());

		if (!StringUtils.isEmpty(mItem.getTips())) {
			ImageView unreadTextView = (ImageView) convertView
					.findViewById(R.id.main_left_unread);
			unreadTextView.setVisibility(View.VISIBLE);
		}
		ImageView tv = (ImageView) convertView.findViewById(R.id.content_text);
		tv.setImageResource(mItem.getResidText());
		// tv.setText(mItem.getTitle());
		return convertView;
	}
}
